/*
 * @Author: 鏉滀簩搴� 3224811364@qq.com
 * @Date: 2024-06-28 11:05:46
 * @LastEditors: 鏉滀簩搴� 3224811364@qq.com
 * @LastEditTime: 2024-07-16 14:54:57
 * @FilePath: src/layouts/MainLayout.tsx
 * @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
 */
import React, {FC} from 'react';
import {Layout, Spin} from "antd";
import {Outlet} from "react-router-dom";
import style from './MainLayout.module.scss'
import Logo from "../components/Logo";
import UserInfo from "../components/UserInfo";
import useLoadUserData from "../hooks/useLoadUserData";
import useNavPage from "../hooks/useNavPage";

const {Header, Footer, Sider, Content} = Layout;

const MainLayout: FC = () => {
  const {waitingUser} = useLoadUserData()
  useNavPage(waitingUser)
  return (
    <Layout>
      <Header className={style.header}>
        <div className={style.left}>
          <Logo/>
        </div>
        <div className={style.right}>
          <UserInfo/>
        </div>
      </Header>
      <Layout>
        <Content className={style.main}>
          {waitingUser ? <div style={{textAlign: 'center', marginTop: '60px'}}>
            <Spin/>
          </div> : <Outlet/>}
        </Content>
      </Layout>

      <Footer className={style.footer}>
        小慕问卷 &copy;2023 - present. Created by 双越老师
      </Footer>
    </Layout>
    // <div className={style.container}>
    //     <div className={style.header}>MainLayout header</div>
    //     <div className={style.content}>
    //         <Outlet/>
    //     </div>
    //     <div className={style.footer}>MainLayout footer</div>
    // </div>
  );
};

export default MainLayout;
